package com.atguigu.lease.common.context;


public class LoginUserContext {
    private static ThreadLocal<LoginUser> threadLocal = new ThreadLocal();
    //向本地线程保存用户的信息
    public static void setUser(LoginUser loginUser) {
        threadLocal.set(loginUser);

    }

    //获取本地线程对象的数据
    public static LoginUser getUser() {
        return threadLocal.get();
    }

    //删除本地线程中的数据(登录的用户信息)
    public static void removeUser() {
        threadLocal.remove();
    }
}
